Delphi code for opening and closing a PrintJob

Calls used
PEOpenEngine
PEOpenPrintJob
PEOpenSubreport
PEClosePrintJob
Code
uses CRDelphi;

procedure OpenPrintJob;
var
  sTmp     : string;
  PrintJob : smallint;
begin
  {Make sure the Engine is Open}
  if not PEOpenEngine then
    {Do Error Handler};

  {Open the Main PrintJob}
  PrintJob := PEOpenPrintJob('C:\Company.rpt');
  {If PrintJob is zero, generate error}
  if PrintJob = 0 then
    {Do Error Handler};
end;


procedure OpenSubreportPrintJob;
var
  sTmp        : string;
  SubPrintJob : smallint;
begin
  {Make sure the Engine is Open}
  if not PEOpenEngine then
    {Do Error Handler};

  {Open the Main PrintJob}
  PrintJob := PEOpenPrintJob('C:\Company.rpt');
  {If PrintJob is zero, generate error}
  if PrintJob = 0 then
    {Do Error Handler};

  {Open a Subreport PrintJob}
  sTmp := 'SubreportName' + #0;
  SubPrintJob := PEOpenSubreport(PrintJob, @sTmp[1]);
  {If PrintJob is zero, generate error}
  if PrintJob = 0 then
    {Do Error Handler};
end;


procedure ClosePrintJob;
begin
  if (PrintJob <> 0) then
  begin
    {Close the Main report}
    if not PEClosePrintJob(PrintJob) then
      {Do Error Handler};
  end;
end;


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com